#ifndef __MSG_HANDLER_BYCATEGORY__
#define __MSG_HANDLER_BYCATEGORY__

#include "Message/MsgHandlerImp.h"
#include "Service/Service.h"


//
//	A message handler containers that forward message to ites sub handler by category
//
class  TCOM_API MsgHandlerDispatchByCate : public MsgHandlerImp
{
public:
	MsgHandlerDispatchByCate();
	virtual~ MsgHandlerDispatchByCate();

	virtual bool initialize(IMsgHandlerInitData* data) ;

	//
	//	dispatch messages according to their category
	//
	virtual bool handleMsg(IMsg* pMsg);

	virtual void addSubHandler(int nMsgCate, int nMsgID, IMsgHandler* pHandler);
	virtual void rmvSubHandler(int nMsgCate, int nMsgID);
private:
	typedef std::map<int, IMsgHandler*> MsgMap;
	MsgMap	m_msgMap;
};




#endif

